import {
    DEFAULT_LINE_WIDTH,
    DEFAULT_RECT_MIN_WIDTH,
    ELES_GAP_HORIZONTAL,
    ELES_GAP_VERTICAL,
    SELECTED_RECT_PADDING,
    TB_PADDING,
    LR_PADDING,
    DEFAULT_FONT_SIZE,
} from "./config";

export abstract class ZoomConfig {
    private _zoomInOut: number = 1; // 缩放比例
    private _zoomFontSize: number = DEFAULT_FONT_SIZE;
    private _diffFontSize: number = 0;

    protected get zoomFontSize(): number {
        return this._zoomFontSize;
    }
    protected set zoomFontSize(fontSize: number) {
        this._zoomFontSize = fontSize;
        this._diffFontSize = fontSize - DEFAULT_FONT_SIZE;
        this._zoomInOut = fontSize / DEFAULT_FONT_SIZE;
    }
    protected get diffFontSize() {
        return this._diffFontSize;
    }
    protected get zoomInOut() {
        return this._zoomInOut;
    }

    /**
     * 计算
     * @param v 
     * @returns 
     */
    protected getZoomValue(v: number) {
        return v * this._zoomInOut;
    }

    protected defaultLineWidth() {
        return {
            bDefaultLineWidth: DEFAULT_LINE_WIDTH,
            defaultLineWidth: DEFAULT_LINE_WIDTH * this._zoomInOut,
        }
    }
    protected get DEFAULT_RECT_MIN_WIDTH() {
        return DEFAULT_RECT_MIN_WIDTH * this._zoomInOut;
    }
    protected get ELES_GAP_HORIZONTAL() {
        return ELES_GAP_HORIZONTAL * this._zoomInOut;
    }
    protected get ELES_GAP_VERTICAL() {
        return ELES_GAP_VERTICAL * this._zoomInOut;
    }
    protected get SELECTED_RECT_PADDING() {
        return SELECTED_RECT_PADDING * this._zoomInOut;
    }
    protected get TB_PADDING() {
        return TB_PADDING * this._zoomInOut;
    }
    protected get LR_PADDING() {
        return LR_PADDING * this._zoomInOut;
    }
}